import {
	BASE_URL
} from "@/utils/Request.js"

//上传图片
export const api_upload = (file) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: `${BASE_URL}/common/uploadOSS`,
			filePath: file.url,
			name: 'file',
			header: {
				Authorization: `Bearer ${uni.getStorageSync("token")}`
			},
			success: (res) => {
				resolve(JSON.parse(res.data));
			},
			fail: (res) => {
				console.log('上传出错', res);
			}
		});
	});
};